home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6355 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.nynexst.com!news
  2. From: Leonid Ilyevsky <leonid@nynexst.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Threads and pipes
  5. Date: Fri, 09 Feb 1996 10:33:21 -0500
  6. Organization: NYNEX S&T
  7. Message-ID: <311B6941.E40@nynexst.com>
  8. NNTP-Posting-Host: orange.nynexst.com
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b6a (X11; I; SunOS 5.4 sun4m)
  13.  
  14. Help ! I need threads in my program to talk to each other through the
  15. pipe. I don't want to use regular Unix pipes (I tested this approach, 
  16. it works fine) because that would involve an overhead of system calls. 
  17. However, I want all the functionality of the pipe, that is:
  18.  
  19. 1. Ability to use iostream methods.
  20. 2. The writing thread should be able to:
  21.    (a) write any information to the pipe like to any stream (see #1)
  22.    (b) close the pipe after it's done
  23. 3. The reading thread should be able to:
  24.    (a) read from the pipe like from any stream (see again #1)
  25.    (b) be blocked if there is nothing to read at the moment, but the
  26.        pipe's writing end is not closed yet
  27.    (c) be waked up when something new was written to the pipe
  28.    (d) get EOF if pipe's writing end is closed and everything is read
  29.  
  30. I tried strstream object, but it has only some of these features.
  31. It has #1 (#2a + #3a), but there is no such thing as #2b. The #3b is 
  32. not there, it gets EOF when everything is read, and the writing thread
  33. is completely confused after that, so don't even ask about #3c.
  34. I learned from the manual that this problem can be solved by overriding
  35. some virtual functions in streambuf base class. But I wonder if there
  36. is something ready to use.
  37.    Please, reply by E-mail.
  38. -- 
  39.  
  40.       Leonid Ilyevsky                       NYNEX Science and Technology 
  41. E-mail: leonid@nynexst.com                  500 Westchester Ave.  
  42. Phone:(914)644-2086 Fax:(914)644-2301       White Plains, NY  10604
  43.